//
//  BIZBussinessPremissCell.m
//  biz
//
//  Created by 小龙 on 2017/3/25.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "BIZBussinessPremissCell.h"
#import "BIZOfficeModel.h"
#import "CWStarRateView.h"

@interface BIZBussinessPremissCell()
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;

@property (weak, nonatomic) IBOutlet UILabel *officeNameLabel;

/*擅长的领域label*/
@property (weak, nonatomic) IBOutlet UILabel *adeptFieldLabel;
//@property (weak, nonatomic) IBOutlet UIImageView *starImageView;
@property (weak, nonatomic) IBOutlet UILabel *gradeLabel;
@property (weak, nonatomic) IBOutlet UILabel *gradeTitleLabel;
@property (weak, nonatomic) IBOutlet CWStarRateView *starView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lineHeightLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *coverImageViewWidthLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *coverImageViewHeightLayout;

@end
@implementation BIZBussinessPremissCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.lineHeightLayout.constant = 0.5;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setOfficeModel:(BIZOfficeModel *)officeModel
{
    _officeModel = officeModel;
    self.officeNameLabel.text = officeModel.name;
    
    self.coverImageViewWidthLayout.constant = 140*kScreenWidthRatio;
    self.coverImageViewHeightLayout.constant = 95*kScreenWidthRatio;

    [SDWebImageTool imageView:self.coverImageView
                    imageName:officeModel.coverImg placeHolder:@"一元许愿颁奖_01" showProgress:YES];
    
    NSString *str = [NSString stringWithFormat:@"擅长领域：%@", officeModel.coreBusi];
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str];
    [attrStr addAttribute:NSForegroundColorAttributeName
                    value:HEXCOLOR(0x3d3d3d)
                    range:NSMakeRange(5, str.length-5)];
    
    self.adeptFieldLabel.attributedText = attrStr;
    
    self.gradeLabel.text = [NSString stringWithFormat:@"%.1f分", officeModel.score];
    
    
    self.starView.scorePercent = officeModel.score;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
//    self.coverImageViewWidthLayout.constant = 119;
//    self.coverImageViewHeightLayout.constant = 81;
}

@end
